home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Waves / WaveType < prev    next >
Text File  |  1996-01-30  |  819b  |  29 lines

  1. | Version 1.2; Use with Igor Pro 3.0 or later only.
  2. |
  3. |    Removed WaveType function because that is now built-in to
  4. |    Igor Pro 3.0. Changed SetWaveType to handle unsigned ints,
  5. |    liberal wave names and data folders
  6.  
  7. | Use value of the kind returned by WaveType() to set the wave's type
  8. | Returns the wave's type before it was changed.
  9. Function SetWaveType(w,wType)
  10.     Wave w;Variable wType
  11.     
  12.     Variable oldType= WaveType(w)
  13.     Variable isCmplx= wType %& 0x1
  14.     Variable isUnsigned= wType %& 0x40
  15.     Variable baseType= wType %& (%~0x41)
  16.     String flags="",aflag="SDBWI???"
  17.     if( isCmplx )
  18.         flags += "/C"
  19.     endif
  20.     if( isUnsigned )
  21.         flags += "/U"
  22.     endif
  23.     flags += "/"+aflag[log(baseType)/log(2)-1]
  24.     String cmd="Redimension"+flags+" $\""+GetWavesDataFolder(w, 1)+PossiblyQuoteName(NameOfWave(w))+"\""
  25.     Execute cmd
  26.     return oldType
  27. End
  28.     
  29.